<template>
	<view>
		<!-- 红包封面 -->
		<view class="rbag_model" v-if="rbagmodelshow" @touchmove.prevent.stop>
			<view class="rbag_con hidden">
				<view class="rbag_top">
					<view class="rbag_top_info">
						<view class="rbag_user">
							<view class="rbag_user_box">
								<view class="rbag_head">
									<image class="rbag_logo" :src="showHbMsg.sendHead"></image>
								</view>
								<view class="rbag_title">
									<text>{{showHbMsg.sendNickname}}发的红包</text>
								</view>
							</view>
						</view>
						<view class="rbag_tips">
							{{JSON.parse(showHbMsg.news).title == ''?"恭喜发财":JSON.parse(showHbMsg.news).title}}
						</view>
					</view>
				</view>
				<view class="open_rbag_btn" :animation="openbrnanimation" @click="openbtn()">開</view>

				<view class="rbag_bottom" @click="gotoDetail" v-if="showHbMsg.chatType == 3 && showHbMsg.sendId == userId">
					看看大家的手气 >
				</view>
			</view>

			<view class="rbag_con">
				<view class="hide_btn" @click.stop="hidebtn">
					<icon type="cancel" color="#fbd977" size="28" />
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	// 应用数字滚动插件
	import countup from '@/components/apk/count-up/count-up.vue';

	import {
		robByUser
	} from '@/api/http/msg/redpkg.js'

	export default {
		components: {
			countup
		},
		props: {
			//1，红包是否展示
			rbagmodelshow: {
				type: Boolean,
				default: false
			},
			//2，红包信息
			showHbMsg: {
				type: Object,
				default: () => {}
			},
			//3，红包打开动画
			openbrnanimation: {
				type: Object,
				default: () => {}
			},
			openrbagmodelshow: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
				userId: uni.getStorageSync('userId')
			}
		},
		methods: {
			// 红包封面 => 关闭按钮
			hidebtn() {
				this.$emit('closeHbFun')
			},
			// 红包封面 => 開红包按钮
			openbtn() {
				this.$emit('openHbFun', this.showHbMsg)
			},
			// 查询红包详情
			gotoDetail() {
				//console.log(this.showHbMsg)
				this.$emit('gotoDetail', this.showHbMsg)
			}
		},
		mounted() {
			//console.log(this.showHbMsg)
		}

	}
</script>

<style lang="scss">
	@import './red_bag.scss';
</style>